package com.yexiao.cofe.business.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yexiao.cofe.business.pojo.Category;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface CategoryMapper extends BaseMapper<Category> {

    @Select("select * from category")
    List<Category> listAll();

    @Select("select count(*) from category where parent_id = #{parentId}")
    int getChildSize(Integer parentId);
    
    @Select("select * from category where name = #{name}")
    Category selectByName(String name);
}
